import React, { FC } from 'react';
import { Router } from 'react-router-dom';
import history from './history';
import { routes } from './routes';
import RouteWithSubRoutes from './route-with-subroutes';

const Routers: FC = () => {
  return (
    <Router history={history}>
      <Container />
    </Router>
  );
};

const Container: FC = () => {
  const route = RouteWithSubRoutes({ routes, handlePathMatched });
  return <>{route}</>;
};

function handlePathMatched(e: any) {
  console.log(e);
}

export default Routers;
